<?
include('../../src/inst.conf.php');

$docentSql = mysql_query("SELECT * FROM  `DOCENT`");
$leerlingSql = mysql_query("SELECT * FROM  `LEERLING`");
$groepSql = mysql_query("SELECT * FROM  `GROEP`");
$vakSQL = mysql_query("SELECT * FROM  `VAK`");
$vaardigheidSQL = mysql_query("SELECT * FROM  `VAARDIGHEID`");
$resultaatvakSQL = mysql_query("SELECT * FROM  `RESULTAAT_VAK`");
$resultaatvaardigheidSQL = mysql_query("SELECT * FROM  `RESULTAAT_VAARDIGHEID`");


$num['Docenten']['value'] = mysql_num_rows($docentSql);
$num['Docenten']['link'] = "./pages/docenten.php";
$num['Leerlingen']['value'] = mysql_num_rows($leerlingSql);
$num['Leerlingen']['link'] = "./pages/leerlingen.php";
$num['Klassen']['value'] = mysql_num_rows($groepSql);
$num['Klassen']['link'] = "./pages/klassen.php";
$num['Vakken']['value'] = mysql_num_rows($vakSQL);
$num['Vakken']['link'] = "#";
$num['Vaardigheden']['value'] = mysql_num_rows($vaardigheidSQL);
$num['Vaardigheden']['link'] = "#";
$num['Resultaten']['value'] = mysql_num_rows($resultaatvaardigheidSQL) + mysql_num_rows($resultaatvakSQL);
$num['Resultaten']['link'] = "#";

?>
<script>
$(document).ready(function() {
    $('ul.statistics li a').click(function(e) {
  		// voorkom dat de link gevolgd wordt
    	e.preventDefault(); 
    	var link =$(this).attr("href");
    	if(link != "#"){
        	//laad de pagina in  #Main container
        	$('#main').fadeOut('fast', function() {
        		$('#main').load(link, function() {
        			$('#main').fadeIn('fast');
        		});
        	});
			$("#primary ul li").removeClass("active");
			$("#primary ul li a[href='" + link + "']").parents("li").addClass("active");
			        	
        }else{
        	//alert('Sorry maar deze pagina bestaat nog niet');
        }
        
    });
});
</script>

<div class="box">
    <div class="box-header">
      <span class="icon16 chart"></span><h1>Database statistieken</h1>
    </div>

    <ul class="statistics">
    <? 
    foreach ($num as $key => $value) {
    	echo"<li>";
    	echo"  <a href=\"".$num[$key]['link']."\">";
    	echo"    <span>".$num[$key]['value']."</span>";
    	echo"    $key";
    	echo"  </a>";
    	echo"</li>";
    }
     ?>
    </ul>

    <div class="action_bar">
      <a href="#" class="button small"><span class="icon16 export"></span>Backup</a>
      <a href="#" class="button small"><span class="icon16 refresh"></span>Zet terug</a>
    </div>
  </div>
 